package com.app.repository.impl;

import com.app.model.main.DeviceToken;
import com.app.repository.interfaces.DeviceTokenMapper;
import com.app.support.dao.MybatisDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Lichaojie on 2017/4/12. It's a beautiful day.
 */
@Repository
public class DeviceTokenMapperImpl implements DeviceTokenMapper {

    @Autowired
    private MybatisDao mybatisDao;

    @Override
    public int deleteByPrimaryKey(Long id){
        return  mybatisDao.delete("com.app.dao.main.DeviceTokenMapper",".deleteByPrimaryKey",id);
    }

    @Override
    public int insert(DeviceToken record){
        return mybatisDao.insert("com.app.dao.main.DeviceTokenMapper",".insert",record);
    }

    @Override
    public int insertSelective(DeviceToken record){
        return mybatisDao.insert("com.app.dao.main.DeviceTokenMapper",".insertSelective",record);
    }

    @Override
    public DeviceToken selectByPrimaryKey(Long id){
        return mybatisDao.get("com.app.dao.main.DeviceTokenMapper",".selectByPrimaryKey",id);
    }

    @Override
    public int updateByPrimaryKeySelective(DeviceToken record){
        return mybatisDao.update("com.app.dao.main.DeviceTokenMapper",".updateByPrimaryKeySelective",record);
    }

    @Override
    public int updateByPrimaryKey(DeviceToken record){
        return mybatisDao.update("com.app.dao.main.DeviceTokenMapper",".updateByPrimaryKey",record);
    }

    @Override
    public DeviceToken selectByUserId(Long userId){
        return mybatisDao.get("com.app.dao.main.DeviceTokenMapper",".selectByUserId",userId);
    }

    @Override
    public List<DeviceToken> getAllDeviceToken(){
        return mybatisDao.getList("com.app.dao.main.DeviceTokenMapper",".getAllDeviceToken");
    }
}
